package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.enums.SheetTypeEnum;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.HandelDetailPojo;
import com.xbongbong.paas.pojo.SummaryDataPoJo;
import com.xbongbong.paas.pojo.dto.FormDataGetDTO;
import com.xbongbong.paas.pojo.vo.FormDataGetVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.pro.appdetail.pojo.MobileDetailDialPhonePojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailMoneyItemPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailSpecialInfoPojo;
import com.xbongbong.pro.appdetail.pojo.dto.PhoneForDialGetDTO;
import com.xbongbong.pro.appdetail.pojo.dto.ReadMessageSetDTO;
import com.xbongbong.pro.appdetail.pojo.dto.SingleDataMessageGetDTO;
import com.xbongbong.pro.appdetail.pojo.vo.PhoneForDialGetVO;
import com.xbongbong.pro.appdetail.pojo.vo.SingleDataMessageGetVO;
import com.xbongbong.pro.applist.pojo.dto.MobileDetailThroughDTO;
import com.xbongbong.pro.form.pojo.TopPermissionsPoJo;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainDTO;
import com.xbongbong.pro.marketManage.pojo.dto.RelationSaleClueListDTO;
import com.xbongbong.pro.marketManage.pojo.vo.RelationSaleClueListVO;
import com.xbongbong.pro.statistic.through.pojo.vo.ResultThroughVO;

import java.util.List;
import java.util.Map;

/**
 * 移动端详情基础信息获取
 *
 * @author GuoJun.HU
 * @date 2019/3/14 10:03
 * @since V1.0
 */
public interface MobileDetailService {

    /**
     * 通过业务类型获取摘要简介中显示的字段
     *
     * @param businessType 业务类型
     * @return JSONArray
     * @author GuoJun.HU
     * @date 2019/3/12 17:23
     * @since V1.0
     */
    JSONArray getShowAttrList(Integer businessType);

    /**
     * 移动端详情基础信息右侧显示的特殊信息
     *
     * @param sheetTypeEnum 回款单类型，如果不是回款单，可默认传null
     * @param corpid 公司id
     * @param loginUser 登录员工
     * @param businessType 业务类型
     * @param paasFormDataEntityExt 数据实体
     * @param explainMap   解释
     * @return MobileDetailSpecialInfoPojo
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 13:47
     * @update 2019/11/29 by zcp 增加回款单情况处理（回款单有7种类型，其中预收款核销的金额在核销金额字段内）
     * @since V1.0
     */
//    MobileDetailSpecialInfoPojo getMobileDetailSpecialInfo(PaymentSheetTypeEnum paymentSheetTypeEnum, String corpid, String userId, Integer businessType, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, Integer flowStatus) throws XbbException;
//    MobileDetailSpecialInfoPojo getMobileDetailSpecialInfo(String corpid, String userId, Integer businessType, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, Integer flowStatus) throws XbbException;
    MobileDetailSpecialInfoPojo getMobileDetailSpecialInfo(SheetTypeEnum sheetTypeEnum, String corpid, UserVO loginUser, Integer businessType, PaasFormDataEntityExt paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap) throws XbbException;
    /**
     * 将summaryList中的数据字典/星级等key值存储的数据转换成value显示的数据
     *
     * @param corpid       公司的id
     * @param summaryList  需要转换的数据
     * @param businessType 业务类型
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 16:16
     * @since V1.0
     */
    void transferKeyToShowValue(String corpid, List<SummaryDataPoJo> summaryList, Integer businessType) throws XbbException;

    /**
     * Description: 将summaryList中的数据字典/星级等key值存储的数据转换成value显示的数据
     * @param corpid
     * @param summaryList
     * @param businessType
     * @throws XbbException XbbException
     * @author 刘阳
     * @date 2019/7/6 1:53 PM
     * @since v1.0
     *
     * 资金管理一期改造，新加入参data，为了获取当中的回款状态
     * @author chenshan
     * @Date 2019-11-06 13:59
     * @param data
     *
     */
    void specialTransferKeyToShowValue(String corpid, List<SummaryDataPoJo> summaryList, Integer businessType, JSONObject data, Long formId) throws XbbException;
    /**
     * 处理summaryList中需要特殊处理的字段
     * 比如：回款关联的合同要支持点击跳转
     * 比如：地址字段要支持点击跳转等
     *
     * @param corpid                公司的id
     * @param summaryList           需要转换的数据
     * @param businessType          业务类型
     * @param data                  表单数据
     * @param dataId                表单数据id
     * @param paasFormDataEntityExt 表单数据扩展
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 16:16
     * @since V1.0
     */
    List<PaasFormDataEntityExt> handleSummarySpecialAttr(String corpid, List<SummaryDataPoJo> summaryList, Integer businessType, JSONObject data, Long dataId, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    /**
     * Description: 处理公海池负责人问题
     * @param corpid
     * @param summaryList
     * @param dataId
     * @param businessType
     * @throws XbbException XbbException
     * @author 刘阳
     * @date 2019/7/8 3:18 PM
     * @since v1.0
     */
    void handelPublic(String corpid, List<SummaryDataPoJo> summaryList, Long dataId, Integer businessType) throws XbbException;

    /**
     * Description: 访客计划延期原因，延期备注
     * @param corpid
     * @param data
     * @param summaryList
     * @param paasFormDataEntityExt
     * @throws XbbException
     * @author 刘阳
     * @date 2019/7/18 9:19 PM
     * @since v1.0
     */
    void handelCommunicatePlan(String corpid, JSONObject data, List<SummaryDataPoJo> summaryList, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    /**
     * Description: 处理访客计划延期标签问题
     * @param summaryList
     * @param data
     * @throws XbbException XbbException
     * @author 刘阳
     * @date 2019/7/15 5:25 PM
     * @since v1.0
     */
    void handleCommunicatePlan(List<SummaryDataPoJo> summaryList, JSONObject data) throws XbbException;

    /**
     * 获取移动端详情基本信息中的底部信息
     *
     * @param corpid       公司id
     * @param userId       用户id
     * @param businessType 业务类型
     * @param dataId       数据id
     * @param data         表单数据
     * @return JSONArray
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 18:50
     * @since V1.0
     */
    JSONArray getBottomBlockInfo(String corpid, String userId, Integer businessType, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, PaasFormDataEntityExt paasFormDataEntityExt, FormDataGetDTO formDataGetDTO) throws XbbException;

    JSONArray getPaasBottomBlockInfo(String corpid, String userId, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, PaasFormDataEntityExt paasFormDataEntityExt, FormDataGetDTO formDataGetDTO) throws XbbException;

    /**
     * 获取移动端详情金额区块信息
     *
     * @param distributorMark 经销商标识
     * @param corpid          公司id
     * @param userId          用户id
     * @param businessType    业务类型
     * @param subBusinessType 具体业务类型 比如：工作报告的日报/周报/月报
     * @param dataId          数据id
     * @param data            表单数据
     * @param explainMap      表单解释
     * @return List
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 18:50
     * @since V1.0
     */
    List<MobileDetailMoneyItemPojo> getMobileDetailMoneyInfo(Integer distributorMark, String corpid, String userId, Integer businessType,
                                                             Integer subBusinessType, Long dataId, JSONObject data,
                                                             Map<String, FieldAttrEntity> explainMap, UserVO loginUser) throws XbbException;

    /**
     * 获取移动端详情页底部操作按钮
     *
     * @param businessType 业务类型
     * @return List
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/4/16 14:40
     * @since V1.0
     */
    List<TopPermissionsPoJo> getMobileDetailBottomOperation(Integer businessType, PaasFormDataEntityExt paasFormDataEntityExt, UserVO userVO) throws XbbException;

    /**
     * 获取移动端详情页底部操作按钮
     * @param handelDetailPojo
     * @return java.util.List<com.xbongbong.pro.form.pojo.TopPermissionsPoJo>
     * @throws XbbException
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    List<TopPermissionsPoJo> getMobileDetailBottomOperation(HandelDetailPojo handelDetailPojo) throws XbbException;

    /**
     * 设置移动端详情页右上角操作按钮
     *
     * @param businessType          业务类型
     * @param formDataGetVO         回参
     * @param paasFormDataEntityExt 表单数据
     * @param userId                用户id
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/4/16 14:45
     * @since V1.0
     */
    void handelMobileWorkFlow(UserVO loginUser, Integer businessType, FormDataGetVO formDataGetVO, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException;

    /**
     * 获取移动端底部联系人拨号
     *
     * @param phoneForDialGetDTO 入参
     * @return 联系方式
     * @throws XbbException 异常
     */
    PhoneForDialGetVO getPhoneForDial(PhoneForDialGetDTO phoneForDialGetDTO) throws XbbException;


    List<MobileDetailDialPhonePojo> handleDialPhone(JSONArray phoneJsonArray, String name, Integer businessType, Long dataId, HandlerExplainDTO handlerExplainDTO,FieldAttrEntity fieldAttrEntity, UserVO loginUser) throws XbbException;

    /**
     * 获取移动端底部提醒
     *
     * @param singleDataMessageGetDTO 入参
     * @return 提醒
     * @throws XbbException 异常
     */
    SingleDataMessageGetVO getSingleDataMessage(SingleDataMessageGetDTO singleDataMessageGetDTO) throws XbbException;

    /**
     * 一键已读
     *
     * @param readMessageSetDTO 入参
     * @return 是否成功
     * @throws XbbException 异常
     */
    BaseVO setReadMessage(ReadMessageSetDTO readMessageSetDTO) throws XbbException;

    /**
     * 详情页特殊穿透到列表页
     *
     * @param mobileDetailThroughDTO
     * @throws
     * @author long.rao
     * @date 2019-06-08 09:26
     */
    ResultThroughVO getDetailThrough(MobileDetailThroughDTO mobileDetailThroughDTO) throws  XbbException;

    /**
     * 市场活动详情页关联线索
     * @param RelationSaleClueListDTO
     * @return
     * @throws XbbException
     */
    RelationSaleClueListVO getAppRelationSaleClueList(RelationSaleClueListDTO RelationSaleClueListDTO) throws  XbbException;

    /**
     * 处理回款计划特殊标签
     *
     * @param labelsList
     * @param data
     */
    void handlePaymentTask(List<SummaryDataPoJo> labelsList, JSONObject data);
}
